﻿/**
 * Unicorn Admin Template
 * Diablo9983 -> diablo9983@gmail.com
**/
$(document).ready(function () {

    $("#form-wizard").formwizard({
        formPluginEnabled: true,
        validationEnabled: true,
        focusFirstInput: true,
        disableUIStyles: true,

        formOptions: {
            success: function (data) { $("#status").fadeTo(500, 1, function () { $(this).html("<span>Form was submitted!</span>").fadeTo(5000, 0); }) },
            beforeSubmit: function (data) { $("#submitted").html("<span>Form was submitted with ajax. Data sent to the server: " + $.param(data) + "</span>"); },
            dataType: 'json',
            resetForm: true
        },
        validationOptions: {
            errorClass: "help-inline",
            errorElement: "span",
            highlight: function (element, errorClass, validClass) {
                $(element).parents('.control-group').addClass('error');
            },
            unhighlight: function (element, errorClass, validClass) {
                $(element).parents('.control-group').removeClass('error');
            }
        }
    });
});
$.validator.addMethod(
    "en",
    function (value, element, param) {
        return /^[A-Za-z0-9\s&\*#@!\$%\(\)]*$/.test(value);
    },
    "只能输入英文"
);
$.validator.addMethod(
    "normalchat",
    function (value, element, param) {
        return /^[A-Za-z0-9\u4e00-\u9fa5\s&\*#@!\$%\(\)]*$/i.test(value);
    },
    "不能包含特殊字符"
);